using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using Microsoft.Reporting.WinForms;

namespace OrionBanque.Rapport.Forms
{
    public partial class fListeUtilisationCheque : ComponentFactory.Krypton.Toolkit.KryptonForm
    {
        private int idCompte;

        public fListeUtilisationCheque(int idC)
        {
            this.idCompte = idC;
            InitializeComponent();
        }

        private void ListeUtilisationCheque_Load(object sender, EventArgs e)
        {
            List<Classe.ChequeOperation> lco = new List<Classe.ChequeOperation>();
            List<Classe.Chequier> lc = Classe.Chequier.ChargeToutCompte(this.idCompte);
            foreach (Classe.Chequier c in lc)
            {
                Classe.ChequeOperation co = new Classe.ChequeOperation();
                co.NumChequier = c.NumChequier;
                co.NumCheque = c.NumCheque;
                if (c.IdOperation != 0 || c.IdOperation == null)
                {
                    Classe.Operations o = Classe.Operations.Charge(c.IdOperation);
                    co.Categorie = Classe.Categorie.Charge(o.IdCategorie).Libelle;
                    co.Date = o.Date;
                    co.DatePointage = o.DatePointage;
                    co.Libelle = o.Libelle;
                    co.Montant = o.Montant;
                    co.Tiers = o.Tiers;
                }
                lco.Add(co);
            }

            var vlco = lco.ToArray();
            //this.rV.PrinterSettings
            this.rV.LocalReport.DataSources.Add(new ReportDataSource("ListingCheque", vlco));

            this.rV.RefreshReport();
        }
    }
}